package com.dictionary.cn.core.dictionaryservice.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.RowMapper;

import com.dictionary.cn.core.DictionaryService;
import com.dictionary.cn.core.FilterProperty;
import com.dictionary.cn.core.dictionaryservice.base.BaseDictionaryService;
import com.dictionary.cn.core.dictionaryservice.dcitionarybean.AdapterDictionary;

public class AdapterDictionaryServiceImpl extends BaseDictionaryService<AdapterDictionary> implements DictionaryService<AdapterDictionary> {
    
    @Override
    public void flush() {
        this.load(this.type, this.param);
    }

    @Override
    public List<AdapterDictionary> getAll(FilterProperty<AdapterDictionary> filterProperty) {
        throw new RuntimeException(AdapterDictionaryServiceImpl.class + "不支持次操作");
    }

    @Override
    public AdapterDictionary getDicByKey(String key) {
        return this.jdbcTemplate.queryForObject(this.param, new RowMapper<AdapterDictionary>() {
            @Override
            public AdapterDictionary mapRow(ResultSet rs, int rowNum) throws SQLException {
                AdapterDictionary ad = new AdapterDictionary();
                
                
                return ad;
            }
        }, key);
    }

    @Override
    public void load(String type, String sql) {
        this.param = sql;
        this.type = type;
    }
   
}
